I have been studying data structures and I do get that Set use implementation similar to hash tables, so the input value + the hash algorithm will create a index where the value is stored...
This will yield the ability to search for such value later in constant time o(1) (disregarding collisions) however this comes at expense of not having an ordered collection since the positions in the collection are computed during insertion instead of order insertion,
So the question is how Set can keep the order and still have constant time on the lookup method Set.has()?
Thank you in advance!